package com.itinsys.enma.web;

import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.itinsys.enma.domain.PriorityEnvironment;
import com.itinsys.enma.domain.response.PriorityEnvironmentResponse;
import com.itinsys.enma.manager.PriorityEnvironmentManager;
import com.itinsys.enma.manager.ResponseManager;

@Controller
@RequestMapping({ "/priorityEnvironment" })
public class PriorityEnvironmentFormController extends FormController {
	protected final Log logger = LogFactory.getLog("controller");
	
	@Autowired
	private PriorityEnvironmentManager priorityEnvironmentManager;

	@Autowired
	private ResponseManager responseManager;
	
	@RequestMapping(value = "/getAll", method = RequestMethod.GET)
	@ResponseBody
	public PriorityEnvironmentResponse getAllPriorityEnvironment() {
		return priorityEnvironmentManager.getAllPriorityEnvironment();
		
	}

	@RequestMapping(value = { "/add" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST })
	@ResponseBody
	public PriorityEnvironmentResponse addPriorityEnvironment(@RequestBody PriorityEnvironment priorityEnvironment,HttpServletResponse response) {
		return this.priorityEnvironmentManager.addPriorityEnvironment(priorityEnvironment);
	}

	
	@RequestMapping(value = { "/delete" }, method = { org.springframework.web.bind.annotation.RequestMethod.POST })
	@ResponseBody
	public PriorityEnvironmentResponse deleteShift(@RequestBody PriorityEnvironment priorityEnvironment,HttpServletResponse response) {
		return this.priorityEnvironmentManager.deletePriorityEnvironment(priorityEnvironment);
	}
}
